<?php
namespace app\admin\controller;
use think\Controller;
use think\Request;
use think\Db;
class News extends Controller
{
    public function index($page=1,$search="search")
    {
		header('Access-Control-Allow-Origin: *');  //I have also tried the * wildcard and get the same response
		$data=['username'=>$search,'state'=>'111'];

        echo json_encode($data);
   }
   public function add(){
	   header('Access-Control-Allow-Origin: *');  //I have also tried the * wildcard and get the same response
	   header('Access-Control-Allow-Headers:  Content-Type');
	   
	   throw_exception('新增失败');
   }
}
